#include "api.h"

Api::Api(apiGui *gui, apiNetwork *network, apiAudio *audio, QObject *parent) : _gui(gui), _network(network), QObject(parent)
{
	_client = new apiClient(this);
	_gui = 0;
	_network = 0;
	_audio = 0;
	_timer = 0;
}

Api::Api(QObject *parent)
{
	_client = new apiClient(this);
}

Api::~Api()
{
	if (_gui)
		delete _gui;
	if (_network)
		delete _network;
	if (_audio)
		delete _audio;
	if (_timer)
		delete _timer;
	delete _client;
}

/* GETTER */

apiGui *			Api::gui() const
{
	return _gui;
}

apiNetwork *		Api::network() const
{
	return _network;
}

apiClient *			Api::client() const
{
	return _client;
}

apiAudio *			Api::audio() const
{
	return _audio;
}

apiTimer *			Api::timer()const
{
	return _timer;
}

/* SETTER */

void				Api::setGui(apiGui *gui)
{
	_gui = gui;
}

void				Api::setNetwork(apiNetwork *network)
{
	_network = network;
}

void				Api::setClient(apiClient *client)
{
	_client = client;
}

void				Api::setAudio(apiAudio *audio)
{
	_audio = audio;
}

void				Api::setTimer(apiTimer *timer)
{
	_timer = timer;
}
